package wang.shuzhu;

public class lianxi3 {
    public static void main(String[] args) {
     //   int arr[] = {1, 2, 3, 4, 5};
   int[] arr=new int[5];

        for (int i = 0; i < 5; i++) {
            arr[i]=i+1;
            System.out.println("arr = " + arr[i]);
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println("arr = " + arr[i]);
        }
        int temp;
        for (int i = 0, j = arr.length - 1; i < j; i++, j--) {
            temp = arr[i];
            arr[i] = arr[j];
            arr[j] = temp;
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println("arr = " + arr[i]);
        }
    }

}



/*

        int[] arr=new int[5];
         int[] a=new int[1];
        for (int i = 0; i < 5; i++) {
            arr[i]=i+1;
            System.out.print(arr[i]+" ");

        }
//arr[0]交换位置arr[4]
       */
/* arr[0]=5;
        arr[4]=1;
*//*

        a[0] = arr[4];int b=arr[3];
        arr[4]=arr[0];
        arr[0]=a[0];
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+" ");

        }
        System.out.println("b = " + b);



*/
